package io.renren.modules.factory.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.reception.entity.TStoreFastfoodRecordEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.factory.dao.TFactoryPurchaseDao;
import io.renren.modules.factory.entity.TFactoryPurchaseEntity;
import io.renren.modules.factory.service.TFactoryPurchaseService;


@Service("tFactoryPurchaseService")
public class TFactoryPurchaseServiceImpl extends ServiceImpl<TFactoryPurchaseDao, TFactoryPurchaseEntity> implements TFactoryPurchaseService {

    @Autowired
    private TFactoryPurchaseDao factoryPurchaseDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TFactoryPurchaseEntity> page = this.page(
                new Query<TFactoryPurchaseEntity>().getPage(params),
                new QueryWrapper<TFactoryPurchaseEntity>()
                .eq("seller_id",params.get("sellerId"))
        );

        return new PageUtils(page);
    }

    @Override
    public Page<TFactoryPurchaseEntity> listPub(Map<String, Object> params) {
        Page<TFactoryPurchaseEntity> page = new Page<TFactoryPurchaseEntity>
                (Long.parseLong((String) params.get("current")),Long.parseLong((String) params.get("size")));

        return factoryPurchaseDao.listPub(page,params);
    }

}